cmake_minimum_required(VERSION 3.13.0)
project(tutorial_vdb CXX)

set(CMAKE_CXX_STANDARD 17)

if(NOT CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
# NOTE: CHOOSE THE O2/O3 is really important for speed! check more on optimization on compile
set(CMAKE_CXX_FLAGS_RELEASE "-O2")

list(APPEND CMAKE_MODULE_PATH "/usr/local/lib/cmake/OpenVDB")
find_package(OpenVDB REQUIRED)

# find_package(glog REQUIRED)
find_package(Eigen3 REQUIRED)

include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR})

add_executable(hello_world tutorial_src/0_hello_world.cpp)
target_link_libraries(hello_world
  # glog::glog
  OpenVDB::openvdb
)

add_executable(create_write_grid tutorial_src/1_cw_grid.cpp)
target_link_libraries(create_write_grid
  # glog::glog
  OpenVDB::openvdb
)

add_executable(read_modi_grid tutorial_src/2_rm_grid.cpp)
target_link_libraries(read_modi_grid
  # glog::glog
  OpenVDB::openvdb
)

add_executable(iterator_range tutorial_src/3_iterator.cpp)
target_link_libraries(iterator_range
  # glog::glog
  OpenVDB::openvdb
)

add_executable(meta_example tutorial_src/4_meta.cpp)
target_link_libraries(meta_example
  # glog::glog
  OpenVDB::openvdb
)

add_executable(node_iterator tutorial_src/5_node_iterator.cpp)
target_link_libraries(node_iterator
  OpenVDB::openvdb
)

add_executable(point_example tutorial_src/6_hello_world_point.cpp)
target_link_libraries(point_example
  OpenVDB::openvdb
)
add_executable(random_point_gen tutorial_src/7_random_point_gen.cpp)
target_link_libraries(random_point_gen
  OpenVDB::openvdb
)
add_executable(point_filter tutorial_src/8_point_filter.cpp)
target_link_libraries(point_filter
  OpenVDB::openvdb
)